<?php

if (!isset($_SESSION['registerAs']['pakket']))
    session_start();

// reference the file containing the profiel class
require_once("profielLib.class.php");

// create a new profiel instance
$profiel = new Profiel();


if (!empty($_SESSION['registerAs']['wachtwoord']) && !empty($_SESSION['registerAs']['rewachtwoord']) && ($_SESSION['registerAs']['wachtwoord'] == $_SESSION['registerAs']['rewachtwoord'])) {

    // check if we have valid values
    if ($_SESSION['registerAs']['onderwijsinstelling'] != '' && 
            $_SESSION['registerAs']['contactpersoon'] != '' && 
            $_SESSION['registerAs']['adres'] != '' &&
            $_SESSION['registerAs']['postcode'] != '' && 
            $_SESSION['registerAs']['woonplaats'] != '' && 
            $_SESSION['registerAs']['telefoon'] != '' && 
            $_SESSION['registerAs']['domein'] != '' && 
            $_SESSION['registerAs']['email'] != '') 
    {
        
        // post the message to the database
        $profiel->postMessage($_SESSION['registerAs']['onderwijsinstelling'], $_SESSION['registerAs']['contactpersoon'], 
                $_SESSION['registerAs']['adres'], $_SESSION['registerAs']['postcode'], $_SESSION['registerAs']['woonplaats'], $_SESSION['registerAs']['provincie'], 
                $_SESSION['registerAs']['telefoon'], $_SESSION['registerAs']['domein'], $_SESSION['registerAs']['email'], $_SESSION['registerAs']['wachtwoord'], $_SESSION['registerAs']['pakket']);
    }
} else {
    echo 'Excuus, er is ergens iets mis gegaan tijdens de registratie. Indien dit meerdere malen gebeurt, neem contact op met Geoplaza.';
}
?>
